Expand description

Macro for building wasmCloud capability providers from WIT contracts.

For example, to build a capability provider for the wasmcloud:keyvalue contract:

wasmcloud_provider_wit_bindgen::generate!({
    impl_struct: KvRedisProvider,
    contract: "wasmcloud:keyvalue",
    wit_bindgen_cfg: "provider-kvredis"
});

struct YourProvider;

All content after wit_bindgen_cfg: is fed to the underlying bindgen (wasmtime::component::macro). In this example, “provider-kvredis” refers to the WIT world that your component will inhabit – expected to be found at <project root>/wit/<your world name>.wit. An example world file:

package wasmcloud:provider-kvredis

world provider-kvredis {
    import wasmcloud:keyvalue/key-value
}

For more information on the options available to underlying bindgen, see the wasmtime-component-bindgen documentation.

Macros§

  • This macro generates functionality necessary to use a WIT-enabled Rust providers (binaries that are managed by the host)